home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1387 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What is wrong in this code?
  5. Date: Sat, 13 Jan 1996 13:32:00 GMT
  6. Organization: Netcom
  7. Message-ID: <30f7b305.66373952@nntp.ix.netcom.com>
  8. References: <DL2z7o.2K5@scisun.sci.ccny.cuny.edu> <4d7kvv$j8@ub239.dialup.uwa.edu.au>
  9. NNTP-Posting-Host: ix-dc11-30.ix.netcom.com
  10. X-NETCOM-Date: Sat Jan 13  5:31:45 AM PST 1996
  11. X-Newsreader: Forte Agent .99c/16.141
  12.  
  13. prye@cyllene.uwa.edu.au (Peter Rye) wrote:
  14.  
  15. |>>x = pow(x,x);
  16. |> ^-------------------- This line is a problem.
  17. |>                       I believe this will give rise to 
  18. |>                       "undefined behavior" because you 
  19. |>                       are modifying x using a function
  20. |>                       which takes x as an argument.
  21. |>                       Use something like y = pow(x,x);
  22. |>                       Where y is declared as a double,
  23. |>                       then use y in the printf below. 
  24.  
  25. Huh?  There's nothing in this statement that results in undefined
  26. behavior.  An object may be referenced and stored between sequence
  27. points provided the referenced value is used to determine the value to
  28. be stored (ISO 6.3) and that certainly holds here.
  29.  
  30.  
  31. Michael M Rubenstein
  32.